<template>
	<view class="transaction">
		<scroll-view @scrolltolower="scrolltolowers()" :scroll-y="true" class="my-content" lower-threshold="50"
			style="margin-top: 0px;height: 100vh;">
			<view class="transaction_card" @click="skip(item)" v-for="(item,index) in list" :key="index"
				v-if="list.length<1?false:true" :class="{op:item.is_read==1}">

				<view class="transaction_card_top">
					<view class="left">
						<image class="icon" :src='serverImageUrl("/static/images/message/gongzuorenwu1.png")'
							style="height: 70.86rpx;width: 70.86rpx;">
						</image>
						<text class="title">{{ item[$t('item.title')]}}</text>
					</view>
					<!-- <view  style="width: 60rpx;text-align: center;">
				  <image :src='serverImageUrl("/static/images/message/right-1-copy.png")' style="height: 30.42rpx;width: 30.95rpx;"></image>
				</view> -->
				</view>
				<view class="transaction_card_body">
					<!-- <text class="bigTitle">{{ item[$t('item.title')] }}</text> -->
					<text class="time">{{ time('S',item.createtime) }}</text>
				</view>
				<view class="transaction_card_bottom">
					{{ item[$t('item.con')] }}
				</view>
			</view>
		</scroll-view>


	</view>
</template>

<script>
	import {
		time
	} from "@/common/public";
	export default {
		data() {
			return {
				other: 'other',
				page: 1,
				list: [],
			};
		},
		onReady() {
			uni.setNavigationBarTitle({
				title: this.$t("交易通知")
			})
		},
		onLoad() {
			this.$u.api.basic.getNoticeList({
				type: this.other,
				page: this.page
			}).then(res => {
				this.list = res
			})
		},
		onShow() {
			// this.$u.api.basic.getNoticeList({
			// 	type: this.other,
			// 	page: this.page
			// }).then(res => {
			// 	this.list = res
			// })
		},
		methods: {
			time,
			skip(ele) {
				console.log(ele);
				this.$u.route({
					url: "/pages/message/systemNotificationDetail/systemNotificationDetail",
					params: {
						id: ele.id
					}
				})
			},
			scrolltolowers(e) {
				console.log(e)
				if (this.list.length === 0) {
					return
				}
				this.page++
				let that = this
				this.$u.api.basic.getNoticeList({
					type: this.other,
					page: this.page
				}).then(res => {
					let list1 = res
					if (!!res && !!res.length) {
						that.list = [...that.list, ...list1]
					}
				})
			},
		},
	}
</script>

<style lang="scss">
	.transaction {
		// height: 93.4vh;
		background-color: $my-bgColorF6F6F6;
		display: flex;
		flex-direction: column;
		padding: 20rpx;

		.transaction_card {

			margin-top: 24.42rpx;
			// height: 286rpx;
			background: #FFFFFF;
			box-shadow: 0rpx 3rpx 7rpx 0rpx rgba(236, 236, 236, 0.5);
			border-radius: 14rpx;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			padding: 26.16rpx;

			.transaction_card_top {
				display: flex;
				justify-content: space-between;
				align-items: center;

				.left {
					font-size: 28rpx;

					font-weight: 400;
					color: #1C1C1C;
					line-height: 30rpx;
					display: flex;
					justify-content: center;
					align-items: center;

					text {
						margin-left: 19.19rpx;
					}
				}
			}

			.transaction_card_body {
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin-top: 20rpx;
				margin-bottom: 20rpx;

				.bigTitle {
					font-size: 28rpx;
					max-width: 400rpx;
					font-weight: 600;
					color: #1C1C1C;
					line-height: 35rpx;
				}

				.time {
					font-size: 26rpx;
					font-weight: 400;
					color: #808080;
					line-height: 30rpx;
					word-break: break-all;
				}

			}

			.transaction_card_bottom {
				// height: 98rpx;
				padding: 10rpx;
				background: #F4F8FA;
				border-radius: 14rpx;
				font-size: 28rpx;
				word-break: break-all;
				font-weight: 400;
				color: #808080;
				// padding: 22.67rpx;
				display: flex;
				align-items: center;
			}
		}
	}

	.op {
		.icon {
			display: none !important;
		}

		.title {
			color: #999 !important;
			margin-left: 0 !important;
		}
	}
</style>